package com.poc.importacao;

import java.io.IOException;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import com.poc.importacao.bacias.BaciaContemBaciaManager;
import com.poc.importacao.bacias.BaciaContemRioManager;
import com.poc.importacao.bacias.EstadoContemBaciaManager;
import com.poc.importacao.bacias.MacrorregiaoContemBaciaManager;
import com.poc.importacao.bacias.MesorregiaoContemBaciaManager;
import com.poc.importacao.bacias.MicrorregiaoContemBaciaManager;
import com.poc.importacao.bacias.MunicipioContemBaciaManager;
import com.poc.importacao.baseabstract.AbstractManager;
import com.poc.importacao.baseabstract.Setup;
import com.poc.importacao.rios.AfluentesManager;
import com.poc.importacao.rios.EstadoContemRioManager;
import com.poc.importacao.rios.MacrorregiaContemRioManager;
import com.poc.importacao.rios.MesorregiaoContemRioManager;
import com.poc.importacao.rios.MicrorregiaoContemRioManager;
import com.poc.importacao.rios.MunicipioContemRioManager;

public class GenerateFiles {

    private static List<AbstractManager> managers;

    static {
	GenerateFiles.managers = new ArrayList<AbstractManager>();

	GenerateFiles.managers.add(new BaciaContemBaciaManager());
	GenerateFiles.managers.add(new BaciaContemRioManager());
	GenerateFiles.managers.add(new EstadoContemBaciaManager());
	GenerateFiles.managers.add(new MacrorregiaoContemBaciaManager());
	GenerateFiles.managers.add(new MesorregiaoContemBaciaManager());
	GenerateFiles.managers.add(new MicrorregiaoContemBaciaManager());
	GenerateFiles.managers.add(new MunicipioContemBaciaManager());

	GenerateFiles.managers.add(new AfluentesManager());
	GenerateFiles.managers.add(new EstadoContemRioManager());
	GenerateFiles.managers.add(new MacrorregiaContemRioManager());
	GenerateFiles.managers.add(new MesorregiaoContemRioManager());
	GenerateFiles.managers.add(new MicrorregiaoContemRioManager());
	GenerateFiles.managers.add(new MunicipioContemRioManager());

	/*
	 * GenerateFiles.managers.add(new EstadoAgrupadoManager()); GenerateFiles.managers.add(new MacrorregiaoAgrupadoManager());
	 * GenerateFiles.managers.add(new MesorregiaoAgrupadaManager()); GenerateFiles.managers.add(new MicrorregiaoAgrupadaManager());
	 * GenerateFiles.managers.add(new MunicipioAgrupadoManager());
	 */}

    /**
     * @param args
     * @throws IllegalAccessException
     * @throws InstantiationException
     * @throws NoSuchMethodException
     * @throws SecurityException
     * @throws IOException
     * @throws SQLException
     */
    public static void main(String[] args) throws InstantiationException, IllegalAccessException, SecurityException, NoSuchMethodException,
	    SQLException, IOException {
	int i = 1;
	Setup.init();
	for (AbstractManager manager : GenerateFiles.managers) {
	    manager.createInserts("out/insert_" + manager.getClass().getSimpleName() + ".sql");
	    System.out.println("Arquivo gerado: " + i++ + " de " + GenerateFiles.managers.size());
	}
    }

}
